#ifndef CONFIG_H
#define CONFIG_H

//QT
#include <QDomDocument>
#include <QStringList>
#include <QHash>

class Config
{
public:
    //Singleton
    static Config *instance ()
    {
        if (m_instance == 0)
            m_instance = new Config();

        return (m_instance);
    }
    ~Config ()
    {
        m_instance = 0;
    }

    void load(const QStringList * argList);
    QString getValue(QString key);

    bool loaded;
private:
    static Config *m_instance;

    QHash<QString, QString> configValues;
    QHash<QString, QString> lineValues;

    bool readLine(const QStringList * argList);
    bool readConfig(const QString location);

    void parseSectionElement(const QDomElement &element);
};

#endif // CONFIG_H
